<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="../css/docs.css" type="text/css" rel="stylesheet" />
<link href="../css/prettify.css" type="text/css" rel="stylesheet" />
<script src="../js/prettify.js" type="text/javascript"></script>
</head>
<body onLoad="prettyPrint()">
<div class="g-unit" id="doc-content">
<div id="api-info-block">
<div class="api-level">H3C CAS云管理平台</div>
</div>
<div id="jd-header">
<h1>修改虚拟交换机</h1>
</div>
<div id="jd-content">
<div class="jd-descr">
<p>修改虚拟交换机。</p>
<h2><a name="uri"></a>接口 URI</h2>
<p>/cas/casrs/vswitch</p>
<h2><a name="access"></a>访问方法</h2>
<dl>
  <dt><b>HTTP 方法</b></dt>
  <dd>PUT</dd>
  <dt><b>消息体</b></dt>
  <div class="source">
  	<pre class="prettyprint lang-xml">&lt;vSwitch&gt;
	&lt;id&gt;4&lt;/id&gt;
	&lt;hostId&gt;2&lt;/hostId&gt;<br>	&lt;name&gt;vswitch0&lt;/name&gt;<br>	&lt;portNum&gt;32&lt;/portNum&gt;<br>	&lt;mode&gt;0&lt;/mode&gt;<br>	&lt;pnic&gt;eth0&lt;/pnic&gt;<br>	&lt;status&gt;1&lt;/status&gt;<br>	&lt;address&gt;192.168.0.8&lt;/address&gt;<br>	&lt;netmask&gt;255.255.255.0&lt;/netmask&gt;<br>	&lt;gateway&gt;192.168.0.1&lt;/gateway&gt;<br>	&lt;enableLacp&gt;false&lt;/enableLacp&gt;<br>	&lt;bondMode&gt;balance-tcp&lt;/bondMode&gt;<br>	&lt;description&gt;test vswitch&lt;/description&gt;<br>	&lt;vlanId&gt;6&lt;/vlanId&gt;<br>      &lt;mtu&gt;1500&lt;/mtu&gt;
&lt;/vSwitch&gt;</pre>
  </div>
</dl>
<dt><a name="detail"></a><b>元素含义</b></dt>
<table class="jd-sumtable" id="pubmethods">
  <tbody>
    <tr>
      <th colspan="2"><span class="prettyprint lang-xml">vSwitch</span>各子元素</th>
	<tr>
      <td class="jd-typecol"><span class="prettyprint lang-xml">id</span></td>
      <td class="jd-linkcol" width="100%"><span class="sympad">虚拟交换机id。</span>
          <div class="jd-descrdiv">长整型（long）类型。</div></td>
    </tr>
	<tr class="alt-color">
      <td class="jd-typecol"><span class="prettyprint lang-xml">hostId</span></td>
      <td class="jd-linkcol" width="100%"><span class="sympad">主机id。</span>
          <div class="jd-descrdiv">长整型（long）类型。</div></td>
    </tr>
    <tr class="alt-color">
      <td class="jd-typecol"><span class="prettyprint lang-xml">name</span></td>
      <td class="jd-linkcol" width="100%"><span class="sympad">虚拟交换机名称。</span>
          <div class="jd-descrdiv">字符串（String）类型。</div></td>
    </tr>
	<tr>
      <td class="jd-typecol"><span class="prettyprint lang-xml">portNum</span></td>
      <td class="jd-linkcol" width="100%"><span class="sympad">端口数量。</span>
          <div class="jd-descrdiv">整数（int）类型。</div></td>
    </tr>
    <tr class="alt-color">
      <td class="jd-typecol"><span class="prettyprint lang-xml">mode</span></td>
      <td class="jd-linkcol" width="100%"><span class="sympad">转发模式。0 : veb; 1: vepa; 2:多通道。</span>
          <div class="jd-descrdiv">整数（int）类型。</div></td>
    </tr>
	<tr>
      <td class="jd-typecol"><span class="prettyprint lang-xml">pnic</span></td>
      <td class="jd-linkcol" width="100%"><span class="sympad">vSwitch绑定的所有物理网卡名。可以为多个，</span>
          <span class="sympad">用英文的逗号分隔，如</span> &lt;pnic&gt;eth0,eth1&lt;pnic&gt;
          <div class="jd-descrdiv">字符串（String）类型。</div></td>
    </tr>
    <tr class="alt-color">
      <td class="jd-typecol"><span class="prettyprint lang-xml">status</span></td>
      <td class="jd-linkcol" width="100%"><span class="sympad">虚拟机交换状态。0:不活动 1:活动。</span>
          <div class="jd-descrdiv">整数（int）类型。</div></td>
    </tr>
 	<tr>
      <td class="jd-typecol"><span class="prettyprint lang-xml">address</span></td>
      <td class="jd-linkcol" width="100%"><span class="sympad">IP地址。</span>
          <div class="jd-descrdiv">字符串（String）类型。</div></td>
    </tr>
    <tr class="alt-color">
      <td class="jd-typecol"><span class="prettyprint lang-xml">netmask</span></td>
      <td class="jd-linkcol" width="100%"><span class="sympad">网络掩码。</span>
          <div class="jd-descrdiv">字符串（String）类型。</div></td>
    </tr>
	<tr>
      <td class="jd-typecol"><span class="prettyprint lang-xml">gateway</span></td>
      <td class="jd-linkcol" width="100%"><span class="sympad">网关。</span>
          <div class="jd-descrdiv">字符串（String）类型。</div></td>
    </tr>
    <tr class="alt-color">
      <td class="jd-typecol"><span class="prettyprint lang-xml">enableLacp</span></td>
      <td class="jd-linkcol" width="100%"><span class="sympad">链路聚合模式(动态链路聚合：true，静态链路聚合：false。</span>
          <div class="jd-descrdiv">布尔（Boolean）类型。</div></td>
    </tr>
		<tr>
      <td class="jd-typecol"><span class="prettyprint lang-xml">bondMode</span></td>
      <td class="jd-linkcol" width="100%"><span class="sympad">负载分担模式。枚举类型，启用lacp:balance-slb ，balance-tcp；不启用lacp:balance-slb ，balance-tcp, active-backup。 <br/>
	  balance-slb : 基本负载分担,balance-tcp : 高级负载分担,active-backup : 主备负载分担
</span>
          <div class="jd-descrdiv">字符串（String）类型。</div></td>
    </tr>
	<tr class="alt-color">
      <td class="jd-typecol"><span class="prettyprint lang-xml">description</span></td>
      <td class="jd-linkcol" width="100%"><span class="sympad">描述信息。</span>
          <div class="jd-descrdiv">字符串（String）类型。</div></td>
    </tr>
		<tr>
      <td class="jd-typecol"><span class="prettyprint lang-xml">vlanId</span></td>
      <td class="jd-linkcol" width="100%"><span class="sympad">VLAN ID。虚拟交换机端口所在<span lang="EN-US">VLAN</span>的<span lang="EN-US">ID</span>。<span lang="EN-US">VLAN ID</span>的取值范围为<span lang="EN-US">2</span>～<span lang="EN-US">4094</span>。</span>
          <div class="jd-descrdiv">整数（int）类型。</div></td>
    </tr>
	<tr class="alt-color">
      <td class="jd-typecol"><span class="prettyprint lang-xml">mtu</span></td>
      <td class="jd-linkcol" width="100%"><span class="sympad">MTU值，取值范围1000-9000。</span>
        <div class="jd-descrdiv">整数（int）类型。</div></td>
    </tr>    
</table>

<h2><a name="result"></a>返回结果</h2>
<dl>
  <dt><b>状态码</b></dt>
  <dd>
  <ul>
    <li>204(No Content)：成功；404(Not Found)：不存在或已删除：</li>
  </ul>
  </dd>
  <dt><b>消息头</b></dt>
  <br>
  <pre class="prettyprint lang-xml">HTTP/1.1 204 No Content<br>Content-Type: application/xml</pre>
</dl>

<p>&nbsp;</p>
<h2><a name="example"></a>应用举例</h2>
    <p>1.修改id为81的虚拟交换机。</p>
    <dl>
      <dt><b>请求</b></dt>
      <div class="source">
        <pre class="prettyprint lang-xml">PUT http://localhost:8080/cas/casrs/vswitch
accept: application/xml
&lt;vSwitch&gt;
	&lt;id&gt;4&lt;/id&gt;
	&lt;hostId&gt;2&lt;/hostId&gt;<br>	&lt;name&gt;vswitch0&lt;/name&gt;<br>	&lt;portNum&gt;32&lt;/portNum&gt;<br>	&lt;mode&gt;0&lt;/mode&gt;<br>	&lt;pnic&gt;eth0&lt;/pnic&gt;<br>	&lt;status&gt;1&lt;/status&gt;<br>	&lt;address&gt;192.168.0.8&lt;/address&gt;<br>	&lt;netmask&gt;255.255.255.0&lt;/netmask&gt;<br>	&lt;gateway&gt;192.168.0.1&lt;/gateway&gt;<br>	&lt;enableLacp&gt;false&lt;/enableLacp&gt;<br>	&lt;bondMode&gt;balance-tcp&lt;/bondMode&gt;<br>	&lt;description&gt;test vswitch&lt;/description&gt;<br>	&lt;vlanId&gt;6&lt;/vlanId&gt;<br>&lt;/vSwitch&gt;</pre>
      </div>
      <dt><b>回应</b></dt>
      <div class="source"><pre class="prettyprint lang-xml">HTTP/1.1 204 No Content<br>Content-Type: application/xml
...<br>无消息体<br></pre>
      </div>
    </dl>
</div>
</div>
</div>
</body>
</html>